package com.xinchuang.controller.image;


import com.alibaba.fastjson.JSONObject;
import com.xinchuang.service.image.GDALService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zx
 * @since 2023-08-31
 */
@RestController
@RequestMapping("/image-editing")
@RequiredArgsConstructor
public class ImageEditingController {

    private final GDALService gdalService;

    @PostMapping("/cut")
    public String cut(@RequestBody JSONObject json) {
        String tifUrl = json.getString("tifUrl");
        String id = json.getString("id");
        Boolean type = json.getBoolean("type");
        if (type) {
            gdalService.tif2DB(tifUrl, id);
        }
        return "完成";
    }

}
